class Animal{

}
class Dog extends Animal{

}
public class Test {
    public static Animal func(){
        Dog dog=new Dog();
        return dog;
    }
    public static void main(String[] args) {
        Animal animal=func();
    }
}
